﻿@model Shop.Models.Category

@{
    ViewBag.Title = "Create";
    Layout = "~/Areas/Admin/Views/Shared/_LayoutForm.cshtml";
}

@using (Ajax.BeginForm("Create","Category",null,new AjaxOptions()
{
    OnSuccess= "closeWin"
}, htmlAttributes: new { @class = "form-horizontal" }))
{
    @Html.AntiForgeryToken()
    
    <div class="form-horizontal">
        <div class="form-group" style="margin:0">
            @Html.LabelFor(model => model.Title, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.Title, new { htmlAttributes = new { @class = "form-control" } })
                @Html.ValidationMessageFor(model => model.Title, "", new { @class = "text-danger" })
            </div>
        </div>

        <div class="form-group" style="margin:0">
            <div class="col-md-offset-2 col-md-10">
                <input type="submit" value="提交" class="btn btn-default" />
                <input type="button" id="btnCancel" value="取消" class="btn btn-default" />
            </div>
        </div>
    </div>
}


@section scripts{
    <script>
        $(function () {
            $('#btnCancel').click(function () {
                parent.closeModal();
            })
        })
        function closeWin() {
            alert('添加成功！');
            parent.closeModal();
        }
    </script>
    
    }
